<html>
<head>
    <meta charset="utf-8">
<#assign base=request.contextPath  />
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <title>妈妈护理记录</title>
    <script type="text/javascript" src="${base}/js/zhang.js"></script>
    <script src="${base}/js/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="${base}/js/ztree/jquery-1.4.4.min.js"></script>
    <script src="${base}/js/jquery.min.js"></script>

    <link rel="stylesheet" href="${base}/js/layui/css/layui.css?t=1534970980648" media="all">


    <style type="text/css">
        form {
            padding: 20px;
        }

        .layui-btn-radius {
            border-radius: 5px;
        }
    </style>
</head>
<body>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
    <legend>妈妈信息</legend>
</fieldset>
<div class="demoTable" style="padding:15px;">
    <button class="layui-btn layui-btn-radius" id="btn2" data-method="offset" type="button"
            style="background-color: #0092EF;">录入妈妈信息
    </button>
    <div class="layui-inline layui-form" style="float:right;">
        <div class="layui-input-inline">
            <select name="modules" lay-verify="required" id="sech" lay-search="">
                <option value="">请选择要搜索的列</option>
                <option value="room_name">房间号</option>
                <option value="username">姓名</option>
                <option value="nursery">育婴师</option>
                <option value="healthWorker">产康师</option>
                <option value="responsible">责任护士</option>
                <option value="diet">饮食情况</option>
                <option value="days">入住天数</option>
                <option value="bloodpressure">血压</option>
                <option value="pulse">脉搏</option>
                <option value="temperature1">体温</option>
                <option value="woundrecovery">伤口恢复情况</option>
                <option value="strapped">绑腹带</option>
                <option value="emotion">情绪</option>
                <option value="sleep">睡眠</option>
                <option value="sweat">褥汗</option>
                <option value="chap">有无皲裂</option>
                <#--<option value="breast">乳房有无皲裂</option>-->
                <option value="filling">充盈程度</option>
                <option value="lochia">恶露量</option>
                <option value="color">恶露颜色</option>
                <option value="taste">有无异味</option>
                <option value="remarks1">备注</option>
            </select>
        </div>
        <div class="layui-inline">
            <input class="layui-input" name="id" id="demoReload" autocomplete="off">
        </div>
        <button class="layui-btn layui-btn-radius" id="btn1" data-type="reload" style="background-color: #0092EF;">搜索
        </button>
    </div>
</div>
<table class="layui-hide" id="table_user" lay-filter="user"></table>
<#--<script type="text/html" id="barDemos">
    <button class="layui-btn layui-btn-sm layui-btn-normal" onclick="selectmother('{{d.id}}')" id="selectmother">详细信息</button>
</script>-->
<script type="text/html" id="barDemo">
    <#--放大镜-->
<#--    <i class="layui-icon layui-icon-search" lay-event="edit" id="updatemother"
       style="font-size: 20px;"></i>&nbsp;&nbsp;&nbsp;-->
<#--编辑-->
<i class="layui-icon layui-icon-edit" lay-event="edit" id="updatemother"
       style="font-size: 20px;"></i>&nbsp;&nbsp;&nbsp;



    <i class="layui-icon layui-icon-delete layui-btn-xs" lay-event="del" id="delectmother" href="javascript:void(0)"
       onclick="delectmother('{{d.id}}')" style="font-size: 20px;"></i>
</script>

<script>
    layui.use(['form', 'layedit', 'laydate', 'table'], function () {
        var form = layui.form
                , $ = layui.jquery
                , layer = layui.layer
                , layedit = layui.layedit
                , laydate = layui.laydate
        table = layui.table;
        //方法级渲染
        table.render({
            elem: '#table_user'
            , url: '${base}/motherNursing/selectMoterNursing'//数据接口
            , toolbar: '#toolbarDemo'
            , defaultToolbar: ['filter', 'print', 'exports']
            , cols: [[
                {
                    field: 'id', templet: function (val) {
                        return val.LAY_INDEX
                    }, title: 'ID', align: 'center', width: 60, fixed: true
                },
                {
                    field: 'createTime', templet: function (val) {
                        return changeDateFormat(val.createTime);
                    }, title: '日期时间', align: 'center', width: 160
                }
                , {field: 'room_name', title: '房间号', align: 'center', width: 80}
                , {field: 'username', title: '姓名', align: 'center', width: 120}
                , {field: 'nursery', title: '育婴师', align: 'center', width: 120}
                , {field: 'healthWorker', title: '产康师', align: 'center', width: 100}
                , {field: 'responsible', title: '责任护士', align: 'center', width: 120}
                , {field: 'days', title: '入住天数', align: 'center', width: 120}
                , {field: 'emotion', title: '情绪', align: 'center', width: 120}
                , {field: 'sleep', title: '睡眠', align: 'center', width: 120}
                , {field: 'diet', title: '饮食情况', align: 'center', width: 120}
                , {field: 'bloodpressure', title: '血压', align: 'center', width: 120}
                , {field: 'pulse', title: '脉搏', align: 'center', width: 120}
                , {field: 'temperature1', title: '体温', align: 'center', width: 120}
                , {field: 'sweat', title: '褥汗', align: 'center', width: 120}
                , {field: 'woundrecovery', title: '伤口情况', align: 'center', width: 120}
                , {field: 'strapped', title: '绑腹带', align: 'center', width: 120}
                , {field: 'chap', title: '乳房有无皲裂', align: 'center', width: 120}
                , {field: 'filling', title: '乳房充盈程度', align: 'center', width: 120}
                , {field: 'lochia', title: '恶露量', align: 'center', width: 120}
                , {field: 'color', title: '恶露颜色', align: 'center', width: 120}
                , {field: 'taste', title: '恶露有无异味', align: 'center', width: 120}
                , {field: 'remarks1', title: '备注', align: 'center', width: 130}
                //, {field: 'breast', title: '乳房护理', align: 'center', width: 160}
               // , {field: 'spirit', title: '精神', align: 'center', width: 60}
                //, {field: 'food', title: '自带食物', align: 'center', width: 60}
               // , {field: 'taboo', title: '饮食忌口', align: 'center', width: 60}
               // , {field: 'ventilation', title: '开窗通风', align: 'center', width: 60}
                //, {field: 'bed', title: '更换床品', align: 'center', width: 60}
                //, {field: 'shift', title: '班次', align: 'center', width: 60}
                //, {field: 'right1', title: '查看文件',toolbar: '#barDemos', width: 100, align: 'center'}
                //,{field:'deliverTime',templet:function(val){
                 //       return GetDateByShiJianChuo(val.deliverTime);
                   // }, title: '分娩时间', align:'center',width:60}
                , {fixed: 'right', title: '操作', toolbar: '#barDemo', width: 150, align: 'center'}
            ]]
            , id: 'testReload'
            , page: {
                layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
                , theme: '#0092EF'
                , limit: 20
            }, done: function (res, curr, count) {
                this.where = {};
            }
            , height: 500
        });
        var active = {
            offset: function (othis) {
                var type = othis.data('type')
                        , text = othis.text();
                layer.open({
                    type: 2,
                    title: '录入妈妈信息',
                    shadeClose: false,
                    offset: 't',
                    area: ['100%', '100%'],
                    content: '${base}/motherNursing/mother_add',
                    success: function (layero, index) {
                        var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象，执行iframe页的方法：iframeWin.method();

                    }
                });
            }
        };
        $('#btn2').on('click', function () {
            var othis = $(this), method = othis.data('method');
            active[method] ? active[method].call(this, othis) : '';
        });

        layui.form.on('select()', function (data) {
            $("#demoReload").val("")
        });
        //编辑弹出层
       /*table.on('tool(user)', function (obj) {
           var layEvent = obj.event;
           if (layEvent == "edit") {
               var data = obj.data;
               //示范一个公告层
               layer.open({
                   type: 2,
                   title: '修改妈妈信息',
                   shadeClose: false,
                   offset: 't',
                   area: ['100%', '100%'],
                   content: '${base}/motherNursing/mother_edit',
                   success: function (layero, index) {
                       var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象，执行iframe页的方法：iframeWin.method();
                       iframeWin.$("#room_name").val(data.room_name)
                       iframeWin.$("#username").val(data.username)
                       iframeWin.$("#temperature1").val(data.temperature1)
                       iframeWin.$("#blood").val(data.bloodpressure)
                       iframeWin.$("#loch").val(data.lochia)
                       iframeWin.$("#chap").val(data.chap)
                       iframeWin.$("#reply").val(data.woundrecovery)
                       iframeWin.$("#room_name").val(data.room_name)
                       iframeWin.$("#filling").val(data.filling)
                       iframeWin.$("#color").val(data.color)
                       iframeWin.$("#taste").val(data.taste)
                       iframeWin.$("#nursery").val(data.nursery)
                       iframeWin.$("#responsible").val(data.responsible)
                       iframeWin.$("#days").val(data.days)
                       iframeWin.$("#pulse").val(data.pulse)
                       iframeWin.$("#strapped").val(data.strapped)
                       iframeWin.$("#sweat").val(data.sweat)
                       iframeWin.$("#sleep").val(data.sleep)
                       iframeWin.$("#emotion").val(data.emotion)
                       iframeWin.$("#remarks1").val(data.remarks1)
                       iframeWin.$("#healthWorker").val(data.healthWorker)
                       iframeWin.$("#diet").val(data.diet)
                       iframeWin.$("#id").val(data.id)
                       setTimeout(function () {
                           iframeWin.$("#homeId option[value='" + data.roomId + "']").attr("selected", "selected");
                           iframeWin.layui.form.render('select')
                       }, 100)
                   }
               });
          }
       } */
            /*if (layEvent == "relaction") {
                var data = obj.data;
                //示范一个公告层
                layer.open({
                    type: 2,
                    title: '修改妈妈信息',
                    shadeClose: false,
                    offset: 't',
                    area: ['100%', '100%'],
                    content: '${base}/motherNursing/RelactionFile.html?RelactionId='+data.id,
                    success: function (layero, index) {
                    }
                })
            }

        });*/
        //编辑弹出层
        /*table.on('tool(user)', function(obj){
            var layEvent = obj.event;
            if(layEvent=="edit"){
                var data = obj.data;
                //示范一个公告层
                layer.open({
                    type: 2,
                    title: '详细信息',
                    offset: 't',
                    shadeClose:false ,
                    area:['100%','100%'],
                    content: '${base}/motherNursing/untitled?homeId=\'+data.homeId',
                    success:function(layero, index){
                        var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象，执行iframe页的方法：iframeWin.method();
                        iframeWin.$("#homeId").val(data.homeId)
                        //时间 createtime
                        iframeWin.$("#createtime").val(changeDateFormat(data.createTime))
                        //房间号
                        iframeWin.$("#room_name").val(data.room_name)
                        //妈妈姓名
                        iframeWin.$("#username").val(data.username)
                        //入住天数
                        iframeWin.$("#days").val(data.days)
                        //责任护士
                        iframeWin.$("#responsible").val(data.responsible)
                        //班次 shift
                        iframeWin.$("#shift").val(data.shift)
                        //乳房护理 breast
                        iframeWin.$("#breast").val(data.breast)
                        //乳房有无皲裂 breast
                        iframeWin.$("#chap").val(data.chap)
                        //充盈程度 filling
                        iframeWin.$("#filling").val(data.filling)
                        //恶露量 lochia
                        iframeWin.$("#lochia").val(data.lochia)
                        //恶露颜色 color
                        iframeWin.$("#color").val(data.color)
                        //有无异味 taste
                        iframeWin.$("#taste").val(data.taste)
                        //伤口情况 woundrecovery
                        iframeWin.$("#woundrecovery").val(data.woundrecovery)
                        //绑腹带 strapped
                        iframeWin.$("#strapped").val(data.strapped)
                        //褥汗 sweat
                        iframeWin.$("#sweat").val(data.sweat)
                        //睡眠 sleep
                        iframeWin.$("#sleep").val(data.sleep)
                        //情绪 emotion
                        iframeWin.$("#emotion").val(data.emotion)
                        //备注 remarks
                        iframeWin.$("#remarks").val(data.remarks)
                        //精神 spirit
                        iframeWin.$("#spirit").val(data.spirit)
                        //自带食物 food
                        iframeWin.$("#food").val(data.food)
                        //饮食忌口 taboo
                        iframeWin.$("#taboo").val(data.taboo)
                        //开窗通风 ventilation
                        iframeWin.$("#ventilation").val(data.ventilation)
                        //更换床品 bed
                        iframeWin.$("#bed").val(data.bed)
                        //宝宝
                        //身高
                        iframeWin.$("#name").val(data.name)
                        iframeWin.$("#heightr").val(data.heightr)
                        //体重 weigth
                        iframeWin.$("#weigth").val(data.weigth)
                        //头围 head
                        iframeWin.$("#head").val(data.head)
                        //喂养类型 food
                        iframeWin.$("#foodd").val(data.foodd)
                        //护理类型
                        iframeWin.$("#ofnursing").val(data.ofnursing)
                        //有无红臀 redbuttocks
                        iframeWin.$("#redbuttocks").val(data.redbuttocks)
                        //睡眠情况 sleepcondition
                        iframeWin.$("#sleepcondition").val(data.sleepcondition)
                        //喂养时间 feedTime
                        //iframeWin.$("#feedTime").val(GetDateByShiJianChuo(data.feedTime))
                        //奶量 feedVolume
                        //iframeWin.$("#feedVolume").val(data.feedVolume)
                        //奶瓶消毒 bottle
                        //iframeWin.$("#bottle").val(data.bottle)
                        //大便时间
                        // Time
                        //iframeWin.$("#shitTime").val(GetDateByShiJianChuo(data.shitTime))
                        //大便色状 shitChromatic
                        //iframeWin.$("#shitChromatic").val(data.shitChromatic)
                        //洗澡 shower
                        iframeWin.$("#shower").val(data.shower)
                        //游泳 swimming
                        iframeWin.$("#swimming").val(data.swimming)
                        //抚触 touch
                        iframeWin.$("#touch").val(data.touch)
                        //挤奶时间 milkTime
                        //iframeWin.$("#milkTime").val(GetDateByShiJianChuo(data.milkTime))
                        //奶量 milkVolume
                        //iframeWin.$("#milkVolume").val(data.milkVolume)
                        //备注 remarks
                        iframeWin.$("#remarks").val(data.remarks)
                        //小便 时间 urineTime
                        //iframeWin.$("#urineTime").val(GetDateByShiJianChuo(data.urineTime))
                        //小便色状 urineChromatic
                        //iframeWin.$("#urineChromatic").val(data.urineChromatic)
                        //育婴师 babynursery
                        iframeWin.$("#babynursery").val(data.babynursery)
                        //宝宝入住天数 day
                        iframeWin.$("#day").val(data.day)
                    }
                });
            }
        });*/







        //弹出上传文档
        table.on('tool(user)', function(obj){
            var layEvent = obj.event;
            if(layEvent=="edit"){
                var data = obj.data;
                //alert(data.id);
                //示范一个公告层
                layer.open({
                    type: 2,
                    title: '详细信息',
                    offset: 't',
                    shadeClose:false ,
                    area:['100%','100%'],
                    content: '${base}/motherNursing/RelactionFile.html?RelactionId='+data.id,
                    success:function(data){
                    }
                });
            }
        });

    });


    //点击放大镜跳转页面
   /* function editWord(id) {
        window.location.href="http://localhost:8080/Zhang/motherNursing/word?id="+id;
    }*/
   //详细信息
    function selectmother(id) {


        layer.open({
            type: 2,
            title: '详细信息',
            offset: 't',
            shadeClose:false ,
            area:['100%','100%'],
            content: '${base}/motherNursing/RelactionFile',
        });
        }

    //删除
    function delectmother(id) {
        layer.confirm('真的要删除吗?', function (index) {
            $.ajax({
                type: "POST",
                url: "${base}/motherNursing/deleteMotherNursing",
                data: {"id": id},
                success: function (data) {
                    var table = layui.table;
                    //表刷新方法
                    table.reload('testReload', {
                        url: '${base}/motherNursing/selectMoterNursing'
                        , where: {} //设定异步数据接口的额外参数
                    });
                    layer.close(index);
                }
            });

        });
    }
    $('#btn1').on('click', function () {
        var sechLin = $("#sech").val();
        var sechData = $("#demoReload").val();
        var whereData = {};
        whereData.lin = sechLin;
        whereData.data = Trim(sechData);
        whereData.page = 1;
        whereData.limt = 10;

        var table = layui.table;
        //表刷新方法
        table.reload('testReload', {
            url: '${base}/motherNursing/selectMoterNursing'
            , where: whereData //设定异步数据接口的额外参数
        });
    });
    //键盘事件
    $("body").bind("keydown", function (e) {
        // 兼容FF和IE和Opera
        var theEvent = e || window.event;
        var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
        if (code == 13) {
            //回车执行查询
            $("#btn1").click();
        }
    });
</script>

</body>
</html>